package com.demo.tools

import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.demo.tools.databinding.TitleCommBinding

/**
 * https://blog.csdn.net/jingzz1/article/details/105909040
 * @auth: LiuLu
 * @date: 2025/4/9 21:10
 */
abstract class BaseBindingActivity<VB : ViewBinding>(val block: (LayoutInflater, ViewGroup, Boolean) -> VB) :
    AppCompatActivity() {

    lateinit var mTitleBinding: TitleCommBinding

    @get:JvmName("mBinding")
    val mBinding by lazy { block(layoutInflater, mTitleBinding.root, true) }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mTitleBinding = TitleCommBinding.inflate(layoutInflater)
        setContentView(mTitleBinding.root)
        initData()
    }

    open fun initData() {}
}